gdk: Remove selection defines
authorBenjamin Otte <otte@redhat.com>
Thu, 14 Dec 2017 00:03:00 +0000 (01:03 +0100)
committerBenjamin Otte <otte@redhat.com>
Thu, 14 Dec 2017 02:05:34 +0000 (03:05 +0100)
And with it, remove the selections section from the docs.

So selections are gone for good now.

15 files changed:
docs/reference/gdk/gdk4-sections.txt
gdk/broadway/gdkproperty-broadway.c
gdk/broadway/gdkselection-broadway.c
gdk/gdk.h
gdk/gdkselection.c
gdk/gdkselection.h [deleted file]
gdk/meson.build
gdk/quartz/gdkselection-quartz.c
gdk/wayland/gdkselection-wayland.c
gdk/win32/gdkproperty-win32.c
gdk/win32/gdkselection-win32.c
gdk/x11/gdkproperty-x11.c
gdk/x11/gdkselection-x11.c
gtk/gtkselection.c
tests/testgtk.c

index 7036a0717fbd4e1920fd0ab4bcd2648f3a2dc92c..01323809670d6b185d75f399e2e14b981935e968 100644 (file)
@@ -406,27 +406,6 @@ gdk_file_list_get_type
 gdk_content_formats_get_type
 </SECTION>
 
-<SECTION>
-<TITLE>Selections</TITLE>
-<FILE>selections</FILE>
-GDK_SELECTION_PRIMARY
-GDK_SELECTION_SECONDARY
-GDK_SELECTION_CLIPBOARD
-GDK_TARGET_BITMAP
-GDK_TARGET_COLORMAP
-GDK_TARGET_DRAWABLE
-GDK_TARGET_PIXMAP
-GDK_TARGET_STRING
-GDK_SELECTION_TYPE_ATOM
-GDK_SELECTION_TYPE_BITMAP
-GDK_SELECTION_TYPE_COLORMAP
-GDK_SELECTION_TYPE_DRAWABLE
-GDK_SELECTION_TYPE_INTEGER
-GDK_SELECTION_TYPE_PIXMAP
-GDK_SELECTION_TYPE_WINDOW
-GDK_SELECTION_TYPE_STRING
-</SECTION>
-
 <SECTION>
 <TITLE>Properties and Atoms</TITLE>
 <FILE>properties</FILE>
index b60488b0eca160ce636638c4382c161981ed565c..0caaf3068878757db014b905653312ededd894e8 100644 (file)
@@ -29,7 +29,6 @@
 #include "gdkinternals.h"
 #include "gdkdisplay-broadway.h"
 #include "gdkprivate-broadway.h"
-#include "gdkselection.h"
 
 #include <string.h>
 
index 9c5a4ab81f367c80e2a6d128d8c4ab165db62867..cce27a767386476221d794c3659f2204e950dff4 100644 (file)
@@ -24,8 +24,6 @@
 
 #include "config.h"
 
-#include "gdkselection.h"
-
 #include "gdkproperty.h"
 #include "gdkprivate-broadway.h"
 #include "gdkdisplay-broadway.h"
@@ -123,7 +121,7 @@ _gdk_broadway_display_text_property_to_utf8_list (GdkDisplay    *display,
   g_return_val_if_fail (length >= 0, 0);
   g_return_val_if_fail (GDK_IS_DISPLAY (display), 0);
 
-  if (encoding == GDK_TARGET_STRING)
+  if (encoding == gdk_atom_intern_static_string ("STRING"))
     {
       return make_list ((gchar *)text, length, TRUE, list);
     }
index 4f0bf80c78e6a98d3e1146c2aa0c6bbdf2ea2d78..1515ad493d1dcf1cfe71ed2af6c1c2d74ce1b172 100644 (file)
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -60,7 +60,6 @@
 #include <gdk/gdkrectangle.h>
 #include <gdk/gdkrgba.h>
 #include <gdk/gdkseat.h>
-#include <gdk/gdkselection.h>
 #include <gdk/gdktexture.h>
 #include <gdk/gdkthreads.h>
 #include <gdk/gdktypes.h>
index 09e495083f07eb3ce67d6e3e94b73be89f37913b..23674b7dd8ca200eb0e36f6c47e1c00b3d14f958 100644 (file)
 
 #include "config.h"
 
-#include "gdkselection.h"
-
 #include "gdkproperty.h"
-#include "gdkdisplayprivate.h"
 
+#include "gdkdisplayprivate.h"
 
-/**
- * SECTION:selections
- * @Short_description: Functions for transfering data via the X selection mechanism
- * @Title: Selections
- *
- * The X selection mechanism provides a way to transfer arbitrary chunks of
- * data between programs. A “selection” is a essentially
- * a named clipboard, identified by a string interned as a #GdkAtom. By
- * claiming ownership of a selection, an application indicates that it will
- * be responsible for supplying its contents. The most common selections are
- * `PRIMARY` and `CLIPBOARD`.
- *
- * The contents of a selection can be represented in a number of formats,
- * called “targets”. Each target is identified by an atom.
- * A list of all possible targets supported by the selection owner can be
- * retrieved by requesting the special target `TARGETS`. When
- * a selection is retrieved, the data is accompanied by a type (an atom), and
- * a format (an integer, representing the number of bits per item).
- * See [Properties and Atoms][gdk3-Properties-and-Atoms]
- * for more information.
- *
- * The functions in this section only contain the lowlevel parts of the
- * selection protocol. A considerably more complicated implementation is needed
- * on top of this. GTK+ contains such an implementation in the functions in
- * `gtkselection.h` and programmers should use those functions
- * instead of the ones presented here. If you plan to implement selection
- * handling directly on top of the functions here, you should refer to the
- * X Inter-client Communication Conventions Manual (ICCCM).
- */
 
 /**
  * gdk_text_property_to_utf8_list_for_display:
diff --git a/gdk/gdkselection.h b/gdk/gdkselection.h
deleted file mode 100644 (file)
index 5728f92..0000000
+++ /dev/null
@@ -1,157 +0,0 @@
-/* GDK - The GIMP Drawing Kit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- */
-
-/*
- * Modified by the GTK+ Team and others 1997-2000.  See the AUTHORS
- * file for a list of people on the GTK+ Team.  See the ChangeLog
- * files for a list of changes.  These files are distributed with
- * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
- */
-
-#ifndef __GDK_SELECTION_H__
-#define __GDK_SELECTION_H__
-
-#if !defined (__GDK_H_INSIDE__) && !defined (GDK_COMPILATION)
-#error "Only <gdk/gdk.h> can be included directly."
-#endif
-
-#include <gdk/gdktypes.h>
-#include <gdk/gdkversionmacros.h>
-
-G_BEGIN_DECLS
-
-/* Predefined atoms relating to selections. In general, one will need to use
- * gdk_intern_atom
- */
-/**
- * GDK_SELECTION_PRIMARY:
- *
- * A #GdkAtom representing the `PRIMARY` selection.
- */
-#define GDK_SELECTION_PRIMARY          gdk_atom_intern_static_string ("PRIMARY")
-
-/**
- * GDK_SELECTION_SECONDARY:
- *
- * A #GdkAtom representing the `SECONDARY` selection.
- */
-#define GDK_SELECTION_SECONDARY        gdk_atom_intern_static_string ("SECONDARY")
-
-/**
- * GDK_SELECTION_CLIPBOARD:
- *
- * A #GdkAtom representing the `CLIPBOARD` selection.
- */
-#define GDK_SELECTION_CLIPBOARD        gdk_atom_intern_static_string ("CLIPBOARD")
-
-/**
- * GDK_TARGET_BITMAP:
- *
- * A #GdkAtom representing the `BITMAP` selection target.
- */
-#define GDK_TARGET_BITMAP              gdk_atom_intern_static_string ("BITMAP")
-
-/**
- * GDK_TARGET_COLORMAP:
- *
- * A #GdkAtom representing the `COLORMAP` selection target.
- */
-#define GDK_TARGET_COLORMAP            gdk_atom_intern_static_string ("COLORMAP")
-
-/**
- * GDK_TARGET_DRAWABLE:
- *
- * A #GdkAtom representing the `DRAWABLE` selection target.
- */
-#define GDK_TARGET_DRAWABLE            gdk_atom_intern_static_string ("DRAWABLE")
-
-/**
- * GDK_TARGET_PIXMAP:
- *
- * A #GdkAtom representing the `PIXMAP` selection target.
- */
-#define GDK_TARGET_PIXMAP              gdk_atom_intern_static_string ("PIXMAP")
-
-/**
- * GDK_TARGET_STRING:
- *
- * A #GdkAtom representing the `STRING` selection target.
- */
-#define GDK_TARGET_STRING              gdk_atom_intern_static_string ("STRING")
-
-/**
- * GDK_SELECTION_TYPE_ATOM:
- *
- * A #GdkAtom representing the `ATOM` selection type.
- */
-#define GDK_SELECTION_TYPE_ATOM        gdk_atom_intern_static_string ("ATOM")
-
-/**
- * GDK_SELECTION_TYPE_BITMAP:
- *
- * A #GdkAtom representing the `BITMAP` selection type.
- */
-#define GDK_SELECTION_TYPE_BITMAP      gdk_atom_intern_static_string ("BITMAP")
-
-/**
- * GDK_SELECTION_TYPE_COLORMAP:
- *
- * A #GdkAtom representing the `COLORMAP` selection type.
- */
-#define GDK_SELECTION_TYPE_COLORMAP    gdk_atom_intern_static_string ("COLORMAP")
-
-/**
- * GDK_SELECTION_TYPE_DRAWABLE:
- *
- * A #GdkAtom representing the `DRAWABLE` selection type.
- */
-#define GDK_SELECTION_TYPE_DRAWABLE    gdk_atom_intern_static_string ("DRAWABLE")
-
-/**
- * GDK_SELECTION_TYPE_INTEGER:
- *
- * A #GdkAtom representing the `INTEGER` selection type.
- */
-#define GDK_SELECTION_TYPE_INTEGER     gdk_atom_intern_static_string ("INTEGER")
-
-/**
- * GDK_SELECTION_TYPE_PIXMAP:
- *
- * A #GdkAtom representing the `PIXMAP` selection type.
- */
-#define GDK_SELECTION_TYPE_PIXMAP      gdk_atom_intern_static_string ("PIXMAP")
-
-/**
- * GDK_SELECTION_TYPE_WINDOW:
- *
- * A #GdkAtom representing the `WINDOW` selection type.
- */
-#define GDK_SELECTION_TYPE_WINDOW      gdk_atom_intern_static_string ("WINDOW")
-
-/**
- * GDK_SELECTION_TYPE_STRING:
- *
- * A #GdkAtom representing the `STRING` selection type.
- */
-#define GDK_SELECTION_TYPE_STRING      gdk_atom_intern_static_string ("STRING")
-
-/* Selections
- */
-
-G_END_DECLS
-
-#endif /* __GDK_SELECTION_H__ */
index 90f8001aac6f66e8980c3a11bd27cf82aa187d62..10a4f6490ba74648f8fa5aaa0be6bc28c7106d25 100644 (file)
@@ -75,7 +75,6 @@ gdk_public_headers = files([
   'gdkrectangle.h',
   'gdkrgba.h',
   'gdkseat.h',
-  'gdkselection.h',
   'gdkthreads.h',
   'gdktexture.h',
   'gdktypes.h',
index 5cc5f68d580b6762d95191620a96a70ad83649fc..855dd3906611a818d7c090da0665df44903d6374 100644 (file)
@@ -20,7 +20,6 @@
 
 #include "config.h"
 
-#include "gdkselection.h"
 #include "gdkproperty.h"
 #include "gdkquartz.h"
 
@@ -110,7 +109,7 @@ _gdk_quartz_display_text_property_to_utf8_list (GdkDisplay    *display,
   g_return_val_if_fail (text != NULL, 0);
   g_return_val_if_fail (length >= 0, 0);
 
-  if (encoding == GDK_TARGET_STRING)
+  if (encoding == gdk_atom_intern_static_string ("STRING"))
     {
       return make_list ((gchar *)text, length, TRUE, list);
     }
index 233eebbcd63ef91c9c3a4270056a43fcba16e736..caec000bb35a5be40629c76091c696b7123a599e 100644 (file)
@@ -29,7 +29,6 @@
 #include "gdkdisplay-wayland.h"
 #include "gdkcontentformatsprivate.h"
 #include "gdkdndprivate.h"
-#include "gdkselection.h"
 #include "gdkproperty.h"
 
 #include <string.h>
index 16a8db5bff97bbcc380b35788d6a45866399992c..4692df5dfc29d8cbed1c2c455377e6558073ffff 100644 (file)
@@ -29,7 +29,6 @@
 #include <glib/gprintf.h>
 
 #include "gdkproperty.h"
-#include "gdkselection.h"
 #include "gdkdisplayprivate.h"
 #include "gdkprivate-win32.h"
 #include "gdkwin32.h"
@@ -49,33 +48,9 @@ _gdk_win32_display_manager_atom_intern (GdkDisplayManager *manager,
   retval = g_hash_table_lookup (atom_hash, atom_name);
   if (!retval)
     {
-      if (strcmp (atom_name, "PRIMARY") == 0)
-       retval = GDK_SELECTION_PRIMARY;
-      else if (strcmp (atom_name, "SECONDARY") == 0)
-       retval = GDK_SELECTION_SECONDARY;
-      else if (strcmp (atom_name, "CLIPBOARD") == 0)
-       retval = GDK_SELECTION_CLIPBOARD;
-      else if (strcmp (atom_name, "ATOM") == 0)
-       retval = GDK_SELECTION_TYPE_ATOM;
-      else if (strcmp (atom_name, "BITMAP") == 0)
-       retval = GDK_SELECTION_TYPE_BITMAP;
-      else if (strcmp (atom_name, "COLORMAP") == 0)
-       retval = GDK_SELECTION_TYPE_COLORMAP;
-      else if (strcmp (atom_name, "DRAWABLE") == 0)
-       retval = GDK_SELECTION_TYPE_DRAWABLE;
-      else if (strcmp (atom_name, "INTEGER") == 0)
-       retval = GDK_SELECTION_TYPE_INTEGER;
-      else if (strcmp (atom_name, "PIXMAP") == 0)
-       retval = GDK_SELECTION_TYPE_PIXMAP;
-      else if (strcmp (atom_name, "WINDOW") == 0)
-       retval = GDK_SELECTION_TYPE_WINDOW;
-      else if (strcmp (atom_name, "STRING") == 0)
-       retval = GDK_SELECTION_TYPE_STRING;
-      else
-       {
-         win32_atom = GlobalAddAtom (atom_name);
-         retval = GUINT_TO_POINTER ((guint) win32_atom);
-       }
+      win32_atom = GlobalAddAtom (atom_name);
+      retval = GUINT_TO_POINTER ((guint) win32_atom);
+
       g_hash_table_insert (atom_hash,
                           g_strdup (atom_name),
                           retval);
@@ -92,17 +67,6 @@ _gdk_win32_display_manager_get_atom_name (GdkDisplayManager *manager,
   gchar name[256];
 
   if (NULL == atom) return g_strdup ("<none>");
-  else if (GDK_SELECTION_PRIMARY == atom) return g_strdup ("PRIMARY");
-  else if (GDK_SELECTION_SECONDARY == atom) return g_strdup ("SECONDARY");
-  else if (GDK_SELECTION_CLIPBOARD == atom) return g_strdup ("CLIPBOARD");
-  else if (GDK_SELECTION_TYPE_ATOM == atom) return g_strdup ("ATOM");
-  else if (GDK_SELECTION_TYPE_BITMAP == atom) return g_strdup ("BITMAP");
-  else if (GDK_SELECTION_TYPE_COLORMAP == atom) return g_strdup ("COLORMAP");
-  else if (GDK_SELECTION_TYPE_DRAWABLE == atom) return g_strdup ("DRAWABLE");
-  else if (GDK_SELECTION_TYPE_INTEGER == atom) return g_strdup ("INTEGER");
-  else if (GDK_SELECTION_TYPE_PIXMAP == atom) return g_strdup ("PIXMAP");
-  else if (GDK_SELECTION_TYPE_WINDOW == atom) return g_strdup ("WINDOW");
-  else if (GDK_SELECTION_TYPE_STRING == atom) return g_strdup ("STRING");
 
   win32_atom = GPOINTER_TO_UINT (atom);
 
index 18a285908a99a529f278a62cc8890aa1e42e66f0..35ef0be45f256c070e594af75d10e9eff5db7169 100644 (file)
@@ -284,7 +284,6 @@ which emits the "drag-data-received" signal for the app.
 #include <shlobj.h>
 
 #include "gdkproperty.h"
-#include "gdkselection.h"
 #include "gdkdisplay.h"
 #include "gdkprivate-win32.h"
 #include "gdkselection-win32.h"
@@ -2558,7 +2557,7 @@ gdk_text_property_to_text_list_for_display (GdkDisplay   *display,
   if (!list)
     return 0;
 
-  if (encoding == GDK_TARGET_STRING)
+  if (encoding == gdk_atom_intern_static_string ("STRING"))
     source_charset = g_strdup ("ISO-8859-1");
   else if (encoding == _gdk_win32_selection_atom (GDK_WIN32_ATOM_INDEX_UTF8_STRING))
     source_charset = g_strdup ("UTF-8");
@@ -2669,7 +2668,7 @@ _gdk_win32_display_text_property_to_utf8_list (GdkDisplay    *display,
   g_return_val_if_fail (text != NULL, 0);
   g_return_val_if_fail (length >= 0, 0);
 
-  if (encoding == GDK_TARGET_STRING)
+  if (encoding == gdk_atom_intern_static_string ("STRING"))
     {
       return make_list ((gchar *)text, length, TRUE, list);
     }
index 5528ada680c0e19066c3f2a5130133d70b26bab7..863cd8556ca77b2bf2d8fa2677a7c1e015204c9f 100644 (file)
@@ -26,7 +26,6 @@
 
 #include "gdkproperty.h"
 #include "gdkinternals.h"
-#include "gdkselection.h"
 #include "gdkprivate-x11.h"
 #include "gdkdisplay-x11.h"
 #include "gdkscreen-x11.h"
index 632684063e49343fe08bff95078d430b137c5042..1162f7c20c6e5e9895d691858835ea4894db7b03 100644 (file)
@@ -24,7 +24,6 @@
 
 #include "config.h"
 
-#include "gdkselection.h"
 #include "gdkproperty.h"
 #include "gdkprivate-x11.h"
 #include "gdkdisplay-x11.h"
@@ -200,7 +199,7 @@ _gdk_x11_display_text_property_to_utf8_list (GdkDisplay    *display,
                                              gint           length,
                                              gchar       ***list)
 {
-  if (encoding == GDK_TARGET_STRING)
+  if (encoding == gdk_atom_intern_static_string ("STRING"))
     {
       return make_list ((gchar *)text, length, TRUE, list);
     }
index 0c7cd566a639f508f30dcc23e8db9207871171f7..25c3b0afb5a6820057db5eab84284cfe28bf2c99 100644 (file)
@@ -170,7 +170,7 @@ gtk_content_formats_add_text_targets (GdkContentFormats *list)
   gdk_content_formats_builder_add_mime_type (builder, utf8_atom);  
   gdk_content_formats_builder_add_mime_type (builder, ctext_atom);  
   gdk_content_formats_builder_add_mime_type (builder, text_atom);  
-  gdk_content_formats_builder_add_mime_type (builder, GDK_TARGET_STRING);  
+  gdk_content_formats_builder_add_mime_type (builder, gdk_atom_intern_static_string ("STRING"));  
   gdk_content_formats_builder_add_mime_type (builder, text_plain_utf8_atom);  
   if (!g_get_charset (NULL))
     gdk_content_formats_builder_add_mime_type (builder, text_plain_locale_atom);  
@@ -479,7 +479,7 @@ selection_set_string (GtkSelectionData *selection_data,
   if (latin1)
     {
       gtk_selection_data_set (selection_data,
-                             GDK_SELECTION_TYPE_STRING,
+                             gdk_atom_intern_static_string ("STRING"),
                              8, (guchar *) latin1, strlen (latin1));
       g_free (latin1);
       
@@ -702,7 +702,7 @@ gtk_selection_data_set_text (GtkSelectionData     *selection_data,
                              8, (guchar *)str, len);
       return TRUE;
     }
-  else if (selection_data->target == GDK_TARGET_STRING)
+  else if (selection_data->target == gdk_atom_intern_static_string ("STRING"))
     {
       return selection_set_string (selection_data, str, len);
     }
@@ -745,7 +745,7 @@ gtk_selection_data_get_text (const GtkSelectionData *selection_data)
   init_atoms ();
   
   if (selection_data->length >= 0 &&
-      (selection_data->type == GDK_TARGET_STRING ||
+      (selection_data->type == gdk_atom_intern_static_string ("STRING") ||
        selection_data->type == ctext_atom ||
        selection_data->type == utf8_atom))
     {
@@ -1131,7 +1131,7 @@ gtk_selection_data_get_targets (const GtkSelectionData  *selection_data,
 
   if (selection_data->length >= 0 &&
       selection_data->format == 32 &&
-      selection_data->type == GDK_SELECTION_TYPE_ATOM)
+      selection_data->type == gdk_atom_intern_static_string ("ATOM"))
     {
       if (targets)
        *targets = g_memdup (selection_data->data, selection_data->length);
@@ -1182,7 +1182,7 @@ gtk_targets_include_text (GdkAtom *targets,
     {
       if (targets[i] == utf8_atom ||
          targets[i] == text_atom ||
-         targets[i] == GDK_TARGET_STRING ||
+         targets[i] == gdk_atom_intern_static_string ("STRING") ||
          targets[i] == ctext_atom ||
          targets[i] == text_plain_atom ||
          targets[i] == text_plain_utf8_atom ||
index 9a16003c567a3f32fd0c290b2920c02a296c5eb9..cb017e738e9761f876922c6bf30a7feeef3fdad6 100644 (file)
@@ -7031,59 +7031,6 @@ create_snapshot (GtkWidget *widget)
   
 }
 
-/*
- * Selection Test
- */
-
-void
-selection_test_received (GtkWidget        *tree_view,
-                         GtkSelectionData *selection_data)
-{
-  GtkTreeModel *model;
-  GtkListStore *store;
-  GdkAtom *atoms;
-  int i, l;
-
-  if (gtk_selection_data_get_length (selection_data) < 0)
-    {
-      g_print ("Selection retrieval failed\n");
-      return;
-    }
-  if (gtk_selection_data_get_data_type (selection_data) != GDK_SELECTION_TYPE_ATOM)
-    {
-      g_print ("Selection \"TARGETS\" was not returned as atoms!\n");
-      return;
-    }
-
-  /* Clear out any current list items */
-
-  model = gtk_tree_view_get_model (GTK_TREE_VIEW (tree_view));
-  store = GTK_LIST_STORE (model);
-  gtk_list_store_clear (store);
-
-  /* Add new items to list */
-
-  gtk_selection_data_get_targets (selection_data,
-                                  &atoms, &l);
-
-  for (i = 0; i < l; i++)
-    {
-      char *name;
-      GtkTreeIter iter;
-
-      name = gdk_atom_name (atoms[i]);
-      if (name != NULL)
-        {
-          gtk_list_store_insert_with_values (store, &iter, i, 0, name, -1);
-          g_free (name);
-        }
-      else
-       gtk_list_store_insert_with_values (store, &iter, i, 0,  "(bad atom)", -1);
-    }
-
-  return;
-}
-
 /*
  * Test scrolling
  */